package chances.webui.taglibs;

import java.util.Random;

import org.apache.commons.lang.StringUtils;

@SuppressWarnings("serial")
public class ButtonTag extends InputTag {
	private String buttonClass;
	private boolean ladda = false;

	public boolean isLadda() {
		return ladda;
	}

	public void setLadda(boolean ladda) {
		this.ladda = ladda;
	}

	public String getButtonClass() {
		return buttonClass;
	}

	public void setButtonClass(String buttonClass) {
		this.buttonClass = buttonClass;
	}

	public String getId() {
		if (StringUtils.isBlank(input.getId())) {
			Random rm = new Random();  
		    double pross = (1 + rm.nextDouble()) * Math.pow(10, 6);  
		    String fixLenthString = String.valueOf(pross);  
			return "btn_"+fixLenthString.substring(1, 6 + 1);
		}
		return input.getId();
	}
}
